package ModelLayer;
import java.util.ArrayList;


/**
 * Write a description of class Sale here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Sale
{
    // instance variables - replace the example below with your own
    private long id;
    private String date;
    private String description;
    private boolean typeBulk;
    private int totalPrice;
    private Customer customer;
    private ArrayList<SalesList> salesList = new ArrayList<SalesList>();

    public Sale()
    {
        totalPrice = 0;
    }
    
    public Sale(long id, String date, String description, boolean typeBulk)
    {
        this.id = id;
        this.date = date;
        this.description = description;
        this.typeBulk = typeBulk;
        this.totalPrice = totalPrice;
    }
    
    public int getPayment()
    {
        totalPrice = 0;
        for (int i=0; i<listAllSalesLists().size(); i++)
        { 
            totalPrice += listAllSalesLists().get(i).getQuantity() * listAllSalesLists().get(i).getSellItem().getPrice();
        }
        
        return totalPrice;
    }
    
    public void createSalesList(SalesList _salesList)
    {
        salesList.add(_salesList);
    }
    
    public void setId(long _id)
    {
        id = _id;
    }
    
    public void setDate(String newdate)
    {
        date = newdate;
    }
    
    public void setDescription(String newdescript)
    {
        description = newdescript;
    }
    
    public void setTypeBulk(boolean newtype)
    {
        typeBulk = newtype;
    }
    
    public void setTotalPrice(int newprice)
    {
        totalPrice = newprice;
    } 
    
    public void setCustomer(Customer _customer)
    {
        customer = _customer;
    }
    
    //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    
    public ArrayList<SalesList> listAllSalesLists()
    {
        return salesList;
    }
    
    public long getId()
    {
        return id;
    }
    
    public String getDate()
    {
        return date;
    }
    
    public String getDescription()
    {
        return description;
    }
    
    public boolean getTypeBulk()
    {
        return typeBulk;
    }
    
    public int getTotalPrice()
    {
        return totalPrice;
    }
    
    public Customer getCustomer()
    {
        return customer;
    }
}
